home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 July: Mac OS SDK / Dev.CD Jul 00 SDK2.toast / Development Kits / Hardware / PowerManager DDK 1.0f1 / Interfaces&Libraries / Interfaces / Finder.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-10-08  |  17.0 KB  |  456 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Finder.h
  3.  
  4.      Contains:    Finder flags and container types.
  5.  
  6.      Version:    Mac OS 8.5
  7.  
  8.      DRI:        Arno Gourdol
  9.  
  10.      Copyright:    © 1990-1999 by Apple Computer, Inc., all rights reserved
  11.  
  12.      Warning:    *** APPLE INTERNAL USE ONLY ***
  13.                  This file may contain unreleased API's
  14.  
  15.      BuildInfo:    Built by:            Scott Johnson
  16.                  On:                    10/8/99 11:26 AM
  17.                  With Interfacer:    3.0d13   (MPW PowerPC)
  18.                  From:                Finder.i
  19.                      Revision:        31
  20.                      Dated:            4/28/99
  21.                      Last change by:    DAL
  22.                      Last comment:    Changed name back to kMagicBusyCreationDate, since that's what
  23.  
  24.      Bugs:        Report bugs to Radar component "System Interfaces", "Latest"
  25.                  List the version information (from above) in the Problem Description.
  26.  
  27. */
  28. #ifndef __FINDER__
  29. #define __FINDER__
  30.  
  31. #ifndef __MACTYPES__
  32. #include <MacTypes.h>
  33. #endif
  34.  
  35. #ifndef __QUICKDRAW__
  36. #include <Quickdraw.h>
  37. #endif
  38.  
  39. #ifndef __EVENTS__
  40. #include <Events.h>
  41. #endif
  42.  
  43.  
  44.  
  45.  
  46. #if PRAGMA_ONCE
  47. #pragma once
  48. #endif
  49.  
  50. #ifdef __cplusplus
  51. extern "C" {
  52. #endif
  53.  
  54. #if PRAGMA_IMPORT
  55. #pragma import on
  56. #endif
  57.  
  58. #if PRAGMA_STRUCT_ALIGN
  59.     #pragma options align=mac68k
  60. #elif PRAGMA_STRUCT_PACKPUSH
  61.     #pragma pack(push, 2)
  62. #elif PRAGMA_STRUCT_PACK
  63.     #pragma pack(2)
  64. #endif
  65.  
  66. /* Creator and type of clipping files */
  67. enum {
  68.     kClippingCreator            = FOUR_CHAR_CODE('drag'),
  69.     kClippingPictureType        = FOUR_CHAR_CODE('clpp'),
  70.     kClippingTextType            = FOUR_CHAR_CODE('clpt'),
  71.     kClippingSoundType            = FOUR_CHAR_CODE('clps'),
  72.     kClippingUnknownType        = FOUR_CHAR_CODE('clpu')
  73. };
  74.  
  75.  
  76. /* Creator and type of Internet Location files */
  77. enum {
  78.     kInternetLocationCreator    = FOUR_CHAR_CODE('drag'),
  79.     kInternetLocationHTTP        = FOUR_CHAR_CODE('ilht'),
  80.     kInternetLocationFTP        = FOUR_CHAR_CODE('ilft'),
  81.     kInternetLocationFile        = FOUR_CHAR_CODE('ilfi'),
  82.     kInternetLocationMail        = FOUR_CHAR_CODE('ilma'),
  83.     kInternetLocationNNTP        = FOUR_CHAR_CODE('ilnw'),
  84.     kInternetLocationAFP        = FOUR_CHAR_CODE('ilaf'),
  85.     kInternetLocationAppleTalk    = FOUR_CHAR_CODE('ilat'),
  86.     kInternetLocationGeneric    = FOUR_CHAR_CODE('ilge')
  87. };
  88.  
  89.  
  90.  
  91. enum {
  92.     kCustomIconResource            = -16455                        /* Custom icon family resource ID */
  93. };
  94.  
  95. /* In order to specify any of the information described in the */
  96. /* CustomBadgeResource data structure you must clear the kExtendedFlagsAreInvalid */
  97. /* and set kExtendedFlagHasCustomBadge of the FXInfo.fdXFlags or DXInfo.frXFlags field, */
  98. /* and add a resource of type kCustomBadgeResourceType and ID kCustomBadgeResourceID to */
  99. /* the file or to the "Icon/n" file for a folder */
  100. enum {
  101.     kCustomBadgeResourceType    = FOUR_CHAR_CODE('badg'),
  102.     kCustomBadgeResourceID        = kCustomIconResource,
  103.     kCustomBadgeResourceVersion    = 0
  104. };
  105.  
  106.  
  107. struct CustomBadgeResource {
  108.     SInt16                             version;                    /* This is version kCustomBadgeResourceVersion*/
  109.     SInt16                             customBadgeResourceID;        /* If not 0, the ID of a resource to use on top*/
  110.                                                                 /* of the icon for this file or folder*/
  111.     OSType                             customBadgeType;            /* If not 0, the type and creator of an icon*/
  112.     OSType                             customBadgeCreator;            /* to use on top of the icon*/
  113.     OSType                             windowBadgeType;            /* If not 0, the type and creator of an icon*/
  114.     OSType                             windowBadgeCreator;            /* to display in the header of the window for this */
  115.                                                                 /* file or folder*/
  116.     OSType                             overrideType;                /* If not 0, the type and creator of an icon to*/
  117.     OSType                             overrideCreator;            /* use INSTEAD of the icon for this file or folder*/
  118. };
  119. typedef struct CustomBadgeResource        CustomBadgeResource;
  120. typedef CustomBadgeResource *            CustomBadgeResourcePtr;
  121. typedef CustomBadgeResourcePtr *        CustomBadgeResourceHandle;
  122. /* You can specify routing information for a file by including a 'rout' 0 
  123.     resource in it and setting the kExtendedFlagHasRoutingInfo bit in the extended 
  124.     Finder flags. 
  125.     The 'rout' resource is an array of RoutingResourceEntry. Each entry is considered
  126.     in turn. The first matching entry is used.
  127.     If the creator and fileType match the file being dropped and targetFolder match
  128.     the folder ID of the folder being dropped onto, then the file is rerouted 
  129.     into the specified destination folder.
  130.     The only target folder currently supported is the system folder, 
  131.     kSystemFolderType = 'macs'.
  132. */
  133. enum {
  134.     kRoutingResourceType        = FOUR_CHAR_CODE('rout'),
  135.     kRoutingResourceID            = 0
  136. };
  137.  
  138.  
  139. struct RoutingResourceEntry {
  140.     OSType                             creator;                    /* Use '****' or 0 to match any creator */
  141.     OSType                             fileType;                    /* Use '****' or 0 to match any file type */
  142.     OSType                             targetFolder;                /* Folder ID of the folder this file was dropped onto */
  143.     OSType                             destinationFolder;            /* Folder that the source will be routed to */
  144.     OSType                             reservedField;                /* Set to 0 */
  145. };
  146. typedef struct RoutingResourceEntry        RoutingResourceEntry;
  147.  
  148. typedef RoutingResourceEntry *            RoutingResourcePtr;
  149. typedef RoutingResourcePtr *            RoutingResourceHandle;
  150.  
  151. /* Types for special container aliases */
  152. enum {
  153.     kContainerFolderAliasType    = FOUR_CHAR_CODE('fdrp'),        /* type for folder aliases */
  154.     kContainerTrashAliasType    = FOUR_CHAR_CODE('trsh'),        /* type for trash folder aliases */
  155.     kContainerHardDiskAliasType    = FOUR_CHAR_CODE('hdsk'),        /* type for hard disk aliases */
  156.     kContainerFloppyAliasType    = FOUR_CHAR_CODE('flpy'),        /* type for floppy aliases */
  157.     kContainerServerAliasType    = FOUR_CHAR_CODE('srvr'),        /* type for server aliases */
  158.     kApplicationAliasType        = FOUR_CHAR_CODE('adrp'),        /* type for application aliases */
  159.     kContainerAliasType            = FOUR_CHAR_CODE('drop'),        /* type for all other containers */
  160.     kDesktopPrinterAliasType    = FOUR_CHAR_CODE('dtpa'),        /* type for Desktop Printer alias */
  161.     kContainerCDROMAliasType    = FOUR_CHAR_CODE('cddr')        /* type for CD-ROM alias */
  162. };
  163.  
  164. /* Types for Special folder aliases */
  165. enum {
  166.     kSystemFolderAliasType        = FOUR_CHAR_CODE('fasy'),
  167.     kAppleMenuFolderAliasType    = FOUR_CHAR_CODE('faam'),
  168.     kStartupFolderAliasType        = FOUR_CHAR_CODE('fast'),
  169.     kPrintMonitorDocsFolderAliasType = FOUR_CHAR_CODE('fapn'),
  170.     kPreferencesFolderAliasType    = FOUR_CHAR_CODE('fapf'),
  171.     kControlPanelFolderAliasType = FOUR_CHAR_CODE('fact'),
  172.     kExtensionFolderAliasType    = FOUR_CHAR_CODE('faex')
  173. };
  174.  
  175. /* Types for AppleShare folder aliases */
  176. enum {
  177.     kExportedFolderAliasType    = FOUR_CHAR_CODE('faet'),
  178.     kDropFolderAliasType        = FOUR_CHAR_CODE('fadr'),
  179.     kSharedFolderAliasType        = FOUR_CHAR_CODE('fash'),
  180.     kMountedFolderAliasType        = FOUR_CHAR_CODE('famn')
  181. };
  182.  
  183. /* Finder flags (finderFlags, fdFlags and frFlags) */
  184. /* Any flag reserved or not specified should be set to 0. */
  185. /* If a flag applies to a file, but not to a folder, make sure to check */
  186. /* that the item is not a folder by checking ((ParamBlockRec.ioFlAttrib & ioDirMask) == 0) */
  187. enum {
  188.     kIsOnDesk                    = 0x0001,                        /* Files and folders (System 6) */
  189.     kColor                        = 0x000E,                        /* Files and folders */
  190.                                                                 /* bit 0x0020 was kRequireSwitchLaunch, but is now reserved for future use*/
  191.     kIsShared                    = 0x0040,                        /* Files only (Applications only) */
  192.                                                                 /* If clear, the application needs to write to */
  193.                                                                 /* its resource fork, and therefore cannot be */
  194.                                                                 /* shared on a server */
  195.     kHasNoINITs                    = 0x0080,                        /* Files only (Extensions/Control Panels only) */
  196.                                                                 /* This file contains no INIT resource */
  197.     kHasBeenInited                = 0x0100,                        /* Files only */
  198.                                                                 /* Clear if the file contains desktop database */
  199.                                                                 /* resources ('BNDL', 'FREF', 'open', 'kind'...) */
  200.                                                                 /* that have not been added yet. Set only by the Finder */
  201.                                                                 /* bit 0x0200 was the letter bit for AOCE, but is now reserved for future use */
  202.     kHasCustomIcon                = 0x0400,                        /* Files and folders */
  203.     kIsStationery                = 0x0800,                        /* Files only */
  204.     kNameLocked                    = 0x1000,                        /* Files and folders */
  205.     kHasBundle                    = 0x2000,                        /* Files only */
  206.     kIsInvisible                = 0x4000,                        /* Files and folders */
  207.     kIsAlias                    = 0x8000                        /* Files only */
  208. };
  209.  
  210. /* Obsolete. Use names defined above. */
  211. enum {
  212.     fOnDesk                        = kIsOnDesk,
  213.     fHasBundle                    = kHasBundle,
  214.     fInvisible                    = kIsInvisible
  215. };
  216.  
  217. /* Obsolete */
  218. enum {
  219.     fTrash                        = -3,
  220.     fDesktop                    = -2,
  221.     fDisk                        = 0
  222. };
  223.  
  224. #if OLDROUTINENAMES
  225. enum {
  226.     kIsStationary                = kIsStationery
  227. };
  228.  
  229. #endif  /* OLDROUTINENAMES */
  230.  
  231. /* Extended flags (extendedFinderFlags, fdXFlags and frXFlags) */
  232. /* Any flag not specified should be set to 0. */
  233. enum {
  234.     kExtendedFlagsAreInvalid    = 0x8000,                        /* If set the other extended flags are ignored */
  235.     kExtendedFlagHasCustomBadge    = 0x0100,                        /* Set if the file or folder has a badge resource */
  236.     kExtendedFlagHasRoutingInfo    = 0x0004                        /* Set if the file contains routing info resource */
  237. };
  238.  
  239.  
  240.  
  241. /* Use a filetype in this range to indicate that a file is temporarily busy */
  242. /* (while it is being downloaded or installed, for example).  This prevents */
  243. /* Finder 8.5 and later from trying to change the item's attributes before it */
  244. /* is fully created. -- If you provide a series of 'BNDL' icons for your creator */
  245. /* and some of these filetypes, you can achieve limited icon animation while */
  246. /* the file creation progresses. */
  247. enum {
  248.     kFirstMagicBusyFiletype        = FOUR_CHAR_CODE('bzy '),
  249.     kLastMagicBusyFiletype        = FOUR_CHAR_CODE('bzy?')
  250. };
  251.  
  252. /* Use this date as a file's or folder's creation date to indicate that it is */
  253. /* temporarily busy (while it is being downloaded or installed, for example). */
  254. /* This prevents Finder from trying to change the item's attributes before it */
  255. /* is fully created (Finder 8.5 and 8.6 check file creation dates; later Finders */
  256. /* may check folder creation dates as well). */
  257. enum {
  258.     kMagicBusyCreationDate        = 0x4F3AFDB0
  259. };
  260.  
  261.  
  262. /*------------------------------------------------------------------------*/
  263. /*
  264.    The following data structures are binary compatible with FInfo, DInfo,
  265.    FXInfo and DXInfo but represent the Mac OS 8 semantic of the fields.
  266.    Use these data structures preferably to FInfo, etc...
  267. */
  268. /*------------------------------------------------------------------------*/
  269.  
  270.  
  271. struct FileInfo {
  272.     OSType                             fileType;                    /* The type of the file */
  273.     OSType                             fileCreator;                /* The file's creator */
  274.     UInt16                             finderFlags;                /* ex: kHasBundle, kIsInvisible... */
  275.     Point                             location;                    /* File's location in the folder */
  276.                                                                 /* If set to {0, 0}, the Finder will place the item automatically */
  277.     UInt16                             reservedField;                /* (set to 0) */
  278. };
  279. typedef struct FileInfo                    FileInfo;
  280.  
  281. struct FolderInfo {
  282.     Rect                             windowBounds;                /* The position and dimension of the folder's window */
  283.     UInt16                             finderFlags;                /* ex. kIsInvisible, kNameLocked, etc.*/
  284.     Point                             location;                    /* Folder's location in the parent folder */
  285.                                                                 /* If set to {0, 0}, the Finder will place the item automatically */
  286.     UInt16                             reservedField;                /* (set to 0) */
  287. };
  288. typedef struct FolderInfo                FolderInfo;
  289.  
  290. struct ExtendedFileInfo {
  291.     SInt16                             reserved1[4];                /* Reserved (set to 0) */
  292.     UInt16                             extendedFinderFlags;        /* Extended flags (custom badge, routing info...) */
  293.     SInt16                             reserved2;                    /* Reserved (set to 0). Comment ID if high-bit is clear */
  294.     SInt32                             putAwayFolderID;            /* Put away folder ID */
  295. };
  296. typedef struct ExtendedFileInfo            ExtendedFileInfo;
  297.  
  298. struct ExtendedFolderInfo {
  299.     Point                             scrollPosition;                /* Scroll position (for icon views) */
  300.     SInt32                             reserved1;                    /* Reserved (set to 0) */
  301.     UInt16                             extendedFinderFlags;        /* Extended flags (custom badge, routing info...) */
  302.     SInt16                             reserved2;                    /* Reserved (set to 0). Comment ID if high-bit is clear */
  303.     SInt32                             putAwayFolderID;            /* Put away folder ID */
  304. };
  305. typedef struct ExtendedFolderInfo        ExtendedFolderInfo;
  306. /*------------------------------------------------------------------------*/
  307. /*
  308.    The following data structures are here for compatibility.
  309.    Use the new data structures replacing them if possible (i.e. FileInfo 
  310.    instead of FInfo, etc...)
  311. */
  312. /*------------------------------------------------------------------------*/
  313. /* File info */
  314. /*
  315.      IMPORTANT:
  316.      In MacOS 8, the fdFldr field has become reserved for the Finder.
  317. */
  318.  
  319. struct FInfo {
  320.     OSType                             fdType;                        /* The type of the file */
  321.     OSType                             fdCreator;                    /* The file's creator */
  322.     UInt16                             fdFlags;                    /* Flags ex. kHasBundle, kIsInvisible, etc. */
  323.     Point                             fdLocation;                    /* File's location in folder. */
  324.                                                                 /* If set to {0, 0}, the Finder will place the item automatically */
  325.     SInt16                             fdFldr;                        /* Reserved (set to 0) */
  326. };
  327. typedef struct FInfo                    FInfo;
  328. /* Extended file info */
  329. /*
  330.      IMPORTANT:
  331.      In MacOS 8, the fdIconID and fdComment fields were changed
  332.      to become reserved fields for the Finder.
  333.        The fdScript has become an extended flag.
  334. */
  335.  
  336. struct FXInfo {
  337.     SInt16                             fdIconID;                    /* Reserved (set to 0) */
  338.     SInt16                             fdReserved[3];                /* Reserved (set to 0) */
  339.     SInt8                             fdScript;                    /* Extended flags. Script code if high-bit is set */
  340.     SInt8                             fdXFlags;                    /* Extended flags */
  341.     SInt16                             fdComment;                    /* Reserved (set to 0). Comment ID if high-bit is clear */
  342.     SInt32                             fdPutAway;                    /* Put away folder ID */
  343. };
  344. typedef struct FXInfo                    FXInfo;
  345. /* Folder info */
  346. /*
  347.      IMPORTANT:
  348.      In MacOS 8, the frView field was changed to become reserved 
  349.        field for the Finder.
  350. */
  351.  
  352. struct DInfo {
  353.     Rect                             frRect;                        /* Folder's window bounds */
  354.     UInt16                             frFlags;                    /* Flags ex. kIsInvisible, kNameLocked, etc.*/
  355.     Point                             frLocation;                    /* Folder's location in parent folder */
  356.                                                                 /* If set to {0, 0}, the Finder will place the item automatically */
  357.     SInt16                             frView;                        /* Reserved (set to 0) */
  358. };
  359. typedef struct DInfo                    DInfo;
  360. /* Extended folder info */
  361. /*
  362.      IMPORTANT:
  363.      In MacOS 8, the frOpenChain and frComment fields were changed
  364.      to become reserved fields for the Finder.
  365.        The frScript has become an extended flag.
  366. */
  367.  
  368. struct DXInfo {
  369.     Point                             frScroll;                    /* Scroll position */
  370.     SInt32                             frOpenChain;                /* Reserved (set to 0) */
  371.     SInt8                             frScript;                    /* Extended flags. Script code if high-bit is set */
  372.     SInt8                             frXFlags;                    /* Extended flags */
  373.     SInt16                             frComment;                    /* Reserved (set to 0). Comment ID if high-bit is clear */
  374.     SInt32                             frPutAway;                    /* Put away folder ID */
  375. };
  376. typedef struct DXInfo                    DXInfo;
  377. /* Values of the 'message' parameter to a Control Panel 'cdev' */
  378. enum {
  379.     initDev                        = 0,                            /*Time for cdev to initialize itself*/
  380.     hitDev                        = 1,                            /*Hit on one of my items*/
  381.     closeDev                    = 2,                            /*Close yourself*/
  382.     nulDev                        = 3,                            /*Null event*/
  383.     updateDev                    = 4,                            /*Update event*/
  384.     activDev                    = 5,                            /*Activate event*/
  385.     deactivDev                    = 6,                            /*Deactivate event*/
  386.     keyEvtDev                    = 7,                            /*Key down/auto key*/
  387.     macDev                        = 8,                            /*Decide whether or not to show up*/
  388.     undoDev                        = 9,
  389.     cutDev                        = 10,
  390.     copyDev                        = 11,
  391.     pasteDev                    = 12,
  392.     clearDev                    = 13,
  393.     cursorDev                    = 14
  394. };
  395.  
  396.  
  397. /* Special values a Control Panel 'cdev' can return */
  398. enum {
  399.     cdevGenErr                    = -1,                            /*General error; gray cdev w/o alert*/
  400.     cdevMemErr                    = 0,                            /*Memory shortfall; alert user please*/
  401.     cdevResErr                    = 1,                            /*Couldn't get a needed resource; alert*/
  402.     cdevUnset                    = 3                                /* cdevValue is initialized to this*/
  403. };
  404.  
  405. /* Control Panel Default Proc */
  406. typedef CALLBACK_API( long , ControlPanelDefProcPtr )(short message, short item, short numItems, short cPanelID, EventRecord *theEvent, long cdevValue, DialogPtr cpDialog);
  407. typedef STACK_UPP_TYPE(ControlPanelDefProcPtr)                     ControlPanelDefUPP;
  408. #if OPAQUE_UPP_TYPES
  409.     EXTERN_API(ControlPanelDefUPP)
  410.     NewControlPanelDefUPP           (ControlPanelDefProcPtr    userRoutine);
  411.  
  412.     EXTERN_API(void)
  413.     DisposeControlPanelDefUPP       (ControlPanelDefUPP        userUPP);
  414.  
  415.     EXTERN_API(long)
  416.     InvokeControlPanelDefUPP       (short                    message,
  417.                                     short                    item,
  418.                                     short                    numItems,
  419.                                     short                    cPanelID,
  420.                                     EventRecord *            theEvent,
  421.                                     long                    cdevValue,
  422.                                     DialogPtr                cpDialog,
  423.                                     ControlPanelDefUPP        userUPP);
  424.  
  425. #else
  426.     enum { uppControlPanelDefProcInfo = 0x000FEAB0 };                 /* pascal 4_bytes Func(2_bytes, 2_bytes, 2_bytes, 2_bytes, 4_bytes, 4_bytes, 4_bytes) */
  427.     #define NewControlPanelDefUPP(userRoutine)                         (ControlPanelDefUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppControlPanelDefProcInfo, GetCurrentArchitecture())
  428.     #define DisposeControlPanelDefUPP(userUPP)                         DisposeRoutineDescriptor(userUPP)
  429.     #define InvokeControlPanelDefUPP(message, item, numItems, cPanelID, theEvent, cdevValue, cpDialog, userUPP)  CALL_SEVEN_PARAMETER_UPP((userUPP), uppControlPanelDefProcInfo, (message), (item), (numItems), (cPanelID), (theEvent), (cdevValue), (cpDialog))
  430. #endif
  431. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  432. #define NewControlPanelDefProc(userRoutine)                     NewControlPanelDefUPP(userRoutine)
  433. #define CallControlPanelDefProc(userRoutine, message, item, numItems, cPanelID, theEvent, cdevValue, cpDialog) InvokeControlPanelDefUPP(message, item, numItems, cPanelID, theEvent, cdevValue, cpDialog, userRoutine)
  434.  
  435.  
  436. #if PRAGMA_STRUCT_ALIGN
  437.     #pragma options align=reset
  438. #elif PRAGMA_STRUCT_PACKPUSH
  439.     #pragma pack(pop)
  440. #elif PRAGMA_STRUCT_PACK
  441.     #pragma pack()
  442. #endif
  443.  
  444. #ifdef PRAGMA_IMPORT_OFF
  445. #pragma import off
  446. #elif PRAGMA_IMPORT
  447. #pragma import reset
  448. #endif
  449.  
  450. #ifdef __cplusplus
  451. }
  452. #endif
  453.  
  454. #endif /* __FINDER__ */
  455.  
  456.